Add hk-sbtc-real-receiver-v1: external sBTC flash-loan receiver + too…#24
Open
unixwhisperer wants to merge 1 commit into
Open
Add hk-sbtc-real-receiver-v1: external sBTC flash-loan receiver + too…#24unixwhisperer wants to merge 1 commit into
unixwhisperer wants to merge 1 commit into
Conversation
…ling External-developer receiver that borrows canonical sBTC from flashstack-sbtc-core, performs a real Velar sBTC -> wSTX -> sBTC round-trip (pool 70), and repays principal + fee atomically. The sBTC counterpart to the STX/Bitflow receiver. Contract (contracts/hk-sbtc-real-receiver-v1.clar): - caller gate: asserts contract-caller == flashstack-sbtc-core (err u403), closing the direct-drain path a public callback would expose - dynamic fee lookup (no hard-coded basis points) - min-out=u1 swap legs with a fail-closed repayment assert; the core's before/after reserve check is the ultimate safety gate (reserve never at risk) - owner-only rescue-sbtc / rescue-wstx; read-only estimate-repayment - absolute mainnet principals throughout; literal principals for the Velar router's trait-reference arguments Tooling (all DRY_RUN-aware with preflight checks): - deploy-hk-sbtc-receiver.mjs deploy from an external wallet - seed-hk-sbtc-receiver.mjs SIP-010 sBTC seed transfer - execute-sbtc-flash-loan.mjs flash loan with approval/reserve/seed preflight - buy-sbtc.mjs acquire the sBTC seed on Velar Docs: - minimum_seed_analysis.md seed sizing from live pool-70 reserves - hk-sbtc-receiver-deployment-plan.md ADRs, validation record, runbook - sbtc-architecture-review.md sBTC engine mapping + live-state findings Validation (off-chain): clarinet check passes against logic-equivalent stubs; caller-gate negative test returns (err u403); deploy/seed/execute/buy scripts build successfully in DRY_RUN against live mainnet reads. No mainnet transactions performed: deployment, whitelisting, and execution remain pending.
|
@unixwhisperer is attempting to deploy a commit to the matt glory's projects Team on Vercel. A member of the Team first needs to authorize it. |
mattglory
approved these changes
Jun 7, 2026
mattglory
left a comment
Owner
There was a problem hiding this comment.
Approved. Contract is clean: caller gate correct, dynamic fee lookup, as-contract on all cross-contract calls, repayment assertion before transfer, rescue-wstx is a good extra safety net for the wSTX-stranded edge case. Pool 70 addresses match the live velar-sbtc-arb-receiver. Ready to whitelist and execute when you are.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…ling
External-developer receiver that borrows canonical sBTC from flashstack-sbtc-core, performs a real Velar sBTC -> wSTX -> sBTC round-trip (pool 70), and repays principal + fee atomically. The sBTC counterpart to the STX/Bitflow receiver.
Contract (contracts/hk-sbtc-real-receiver-v1.clar):
Tooling (all DRY_RUN-aware with preflight checks):
Docs:
Validation (off-chain): clarinet check passes against logic-equivalent stubs; caller-gate negative test returns (err u403); deploy/seed/execute/buy scripts build successfully in DRY_RUN against live mainnet reads. No mainnet transactions performed: deployment, whitelisting, and execution remain pending.
Description
Type of Change
Related Issues
Fixes #
Related to #
Changes Made
Testing Performed
Manual Testing
clarinet checkclarinet consoleAutomated Testing
Test Commands Run
# List the commands you ran to test clarinet check clarinet console3Test Results
Checklist
Code Quality
Documentation
Testing
Security & Safety
Screenshots (if applicable)
Additional Context
Deployment Considerations
By submitting this PR, I confirm that: